package main

import (
	"errors"
	"fmt"
)

func main() {
	fn2()

	fmt.Println("Hello World")

	sendMail()
}

func sendMail() {
	defer func() {
		err := recover()
		if err != nil {
			fmt.Println(err)
		}
	}()

	var err = readFile("xxx.go")
	if err != nil {
		panic(err)
	}

	fmt.Println("continue ....>>>>>")
}

func readFile(fileName string) error {
	if fileName == "mian.go" {
		return nil
	}

	return errors.New("读取文件错误")
}

func fn2() {
	defer func() {
		err := recover()
		if err != nil {
			fmt.Printf("异常了,报错信息 %v", err)
		}
	}()

	num1 := 10
	num2 := 0
	res := num1 / num2
	fmt.Println(res)

}
